if($ == undefined){

     alert();
	 function $(id){
	 	if(typeof id == "object") return id;
		return document.getElementById(id);
	}
}
function selectedCheckbox(flag){
  var eles = document.getElementsByTagName("INPUT");
  for(i = 0; i < eles.length; i++){
      var objValue = eles[i].value.replace(/ /g, "");
      if(eles[i].type == "checkbox" && objValue != "" && objValue != "false"){
        if(flag != true){
			eles[i].click();
		}else{
			eles[i].checked = true;
		}
      }
  }
}
function clickObject(id, value){
    var obj = $(id);
   if(obj.tagName == "SELECT"){
      for(var i=0; i<obj.options.length; i++) {

        if(obj.options[i].value==value){
              obj.options[i].selected=true;
           }
    }
    obj.fireEvent("onchange");
   }else{

     if(obj.tagName == "INPUT" && obj.type == "radio"){
	     var objs = document.getElementsByName(id);
         objs[value - 1].click();
	 }else{
		 if(obj.tagName == "INPUT" && obj.type == "checkbox"){
		    var objs = document.getElementsByName(id);
	        for(i = 0; i < objs.length; i++){
	            objs[i].click();
	        }
		 }
		 else{
	         obj.click();
		 }
	  }
   }
}
function getRadioValue(name){
    var objs = document.getElementsByName(name);
    for (i=0; i<objs.length; i++){
	    if(objs[i].checked){
		   return objs[i].value;
		}
	}
}
function selectAll(){
	var currId = arguments[0];
	var currValue = currId.checked;
	for(i = 1; i <  arguments.length; i++){
		var checkboxObj = document.getElementsByName(arguments[i]);
		for(j = 0; j < checkboxObj.length; j++){
			checkboxObj[j].checked = currValue;
		}
	}
}
function delDisplayIsNone(thisTemp){
	//alert(thisTemp.id)
	if (thisTemp.children.length == 0)
	{
		return true;
	}
	if(thisTemp.style.display == "none"){

		var chdTemp = thisTemp.children;
		for(var j = 0; j< chdTemp.length; j++){
			chdTemp[j].removeNode(true);
		}
	}else{
		var childs = thisTemp.children;
		var count = childs.length;
		for(var i = 0; i< count; i++){
			delDisplayIsNone(childs[i]);
		}
	}
	return true;
}
function selectedCheckboxByValue(name, list){
	var currEles = document.getElementsByName(name);
	if(list.constructor != Array){
		 alert("The second parameter must is a Array ojbct")
		 return false;
    }
	var eLength = currEles.length;
	var count = list.length;
	for(var j = 0; j < eLength; j++){
		var eleValue = currEles[j].value;
		for(var i = 0; i <  count; i++){
			if(list[i] == eleValue){
				currEles[j].checked = true;
				break;
			}
		}
	}
}

